import { PageContainer } from '@ant-design/pro-components';
import { message } from 'antd';
import './index.scss'
import { use } from 'echarts';
import { useEffect } from 'react';

function BatchList(){
    const [messageApi, contextHolder] = message.useMessage();
    const newAjax =()=>{
        const xhr = new XMLHttpRequest();
        xhr.open('GET', 'https://jsonplaceholder.typicode.com/posts/1', true);
        xhr.onreadystatechange=() => {
            if (xhr.readyState === 4) { 
                if (xhr.status === 200) {
                    const response = JSON.parse(xhr.responseText);
                    messageApi.success(`请求成功: ${response.title}`);
                } else {
                    messageApi.error(`请求失败: ${xhr.status}`);
                }
            }       
            xhr.onerror = () => {
                messageApi.error('网络错误，请稍后再试');
            }   
            xhr.send();
    }}
    useEffect(() => {
        for (var i = 0; i <= 5; i++) {
            setTimeout(()=>{
                console.log(i);
            })
        }
    }, []);
    
    return (
        <PageContainer> 
            {contextHolder}
            <div className="container clearfix">
                <div className='div1'></div>    
            </div>
            <p>标签</p>
        </PageContainer>
    )
}

export default BatchList;